///\todo upgrade

//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//  This file is part of the buola project (https://code.google.com/p/buola/).  //
//                                                                              //
//  Copyright(c) 2007-2012 Xavi Gratal                                          //
//  gratal AT gmail DOT com                                                     //
//                                                                              //
//  Buola is free software: you can redistribute it and/or modify               //
//  it under the terms of the GNU General Public License as published by        //
//  the Free Software Foundation, either version 3 of the License, or           //
//  (at your option) any later version.                                         //
//                                                                              //
//  Buola is distributed in the hope that it will be useful,                    //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of              //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               //
//  GNU General Public License for more details.                                //
//                                                                              //
//  You should have received a copy of the GNU General Public License           //
//  along with buola.  If not, see <http://www.gnu.org/licenses/>.              //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////

#ifndef __BUOLA_TTY_CCOMPLETION_H__
#define __BUOLA_TTY_CCOMPLETION_H__

#include <buola/buola.h>
#include <buola/tty/enums.h>

namespace buola { namespace tty {

///\addtogroup tty
///@{

template<typename tString>    
class CCompletion
{
public:
    struct SOption
    {
        SOption(const tString &pText,const tString &pDisplay,EColor pColor)
            :   mText(pText)
            ,   mDisplay(pDisplay)
            ,   mColor(pColor)
        {}
        
        SOption(const SOption &pRH)
            :   mText(pRH.mText)
            ,   mDisplay(pRH.mDisplay)
            ,   mColor(pRH.mColor)
        {}
        
        SOption(SOption &&pRH)
            :   mText(std::move(pRH.mText))
            ,   mDisplay(std::move(pRH.mDisplay))
            ,   mColor(std::move(pRH.mColor))
        {}
        
        SOption &operator=(const SOption &pRH)
        {
            mText=pRH.mText;
            mDisplay=pRH.mDisplay;
            mColor=pRH.mColor;

            return *this;
        }

        bool operator<(const SOption &pRH) const
        {
            return mDisplay<pRH.mDisplay;
        }
        
        tString mText;
        tString mDisplay;
        EColor mColor;
    };
    
    struct SGroup
    {
        //to be filled by completer
        bool mSorted;
        tString mName;
        
        std::vector<SOption> mOptions;
    };
    
    std::vector<SGroup> mGroups;
    int mB;
    int mE;
};

///@}

/*namespace tty*/ } /*namespace buola*/ }

#endif
